import { PORT1 } from "@/api/config/servicePort";
import Http from "@/api/index";

const baseUrl = PORT1 + "/system/account";

export const sendCode = (phone: string) => {
  return Http.post(PORT1 + "/send", { phone });
};
export const sendAccountCode = (phone: string) => {
  return Http.post(baseUrl + "/send", { phone });
};

export const GetRegionByAccount = () => {
  return Http.get(baseUrl + "/area");
};

export const GetAccountList = (param: any) => {
  return Http.post(baseUrl + "/list", param);
};

export const GetRoleByAccount = () => {
  return Http.get(baseUrl + "/get_roles");
};

export const AddAccount = (params: any) => {
  return Http.post(baseUrl + "/add", params);
};

export const editAccount = (params: any) => {
  return Http.put(baseUrl + "/edit", params);
};

export const editPhone = (params: any) => {
  return Http.put(baseUrl + "/change_phone", params);
};
export const editCard = (params: any) => {
  return Http.put(baseUrl + "/change_card", params);
};

export const deleteAccount = (params: any) => {
  return Http.post(baseUrl + "/delete", params);
};

export const getRegionCanSetbyAccount = () => {
  return Http.get(baseUrl + "/get_region");
};

export const setAccountPowerRegion = (params: any) => {
  return Http.put(baseUrl + "/set_region", params);
};

export const getUserInfo = () => {
  return Http.get(baseUrl + "/info");
};

export const setStatus = (params: any) => {
  return Http.post(baseUrl + "/status", params);
};

// 生成二维码
export const genCode = (params: any) => {
  return Http.get(baseUrl + "/qr_code", params);
};
